function SettingsAssistant(sceneAssistant, digits, direction, callbackFunction) {
	this.sceneAssistant = sceneAssistant;
	this.controller = sceneAssistant.controller;
	this.digits = digits;
	this.direction = direction;
	this.callbackFunction = callbackFunction;
};

SettingsAssistant.prototype.setup = function(widget) {
	this.widget = widget;

	// Widgets for digits
	this.controller.setupWidget('digit-1',
		{
			'min': 0,
			'max': 9
		},
		this.digit1Model = {
			'value': this.digits[0]
		}
	);
	this.controller.setupWidget('digit-2',
		{
			'min': 0,
			'max': 9
		},
		this.digit2Model = {
			'value': this.digits[1]
		}
	);
	this.controller.setupWidget('digit-3',
		{
			'min': 0,
			'max': 9
		},
		this.digit3Model = {
			'value': this.digits[2]
		}
	);
	this.controller.setupWidget('digit-4',
		{
			'min': 0,
			'max': 9
		},
		this.digit4Model = {
			'value': this.digits[3]
		}
	);

	// Direction of counting
	this.controller.setupWidget('direction',
		{
			'choices': [
				{'label': $L("Increase"), 'value':'up'},
				{'label': $L("Decrease"), 'value':'down'}
			],
			'label': $L("On tap"),
			'labelPlacement': Mojo.Widget.labelPlacementLeft
		},
		this.modelDirection = {
			'value': this.direction,
			'disabled': false
		}
	);

	// Handler for Save button
	this.save = this.save.bind(this);
	Mojo.Event.listen(this.controller.get('save-button'), Mojo.Event.tap, this.save);
};

SettingsAssistant.prototype.activate = function(event) {
};

SettingsAssistant.prototype.deactivate = function(event) {
};

SettingsAssistant.prototype.cleanup = function(event) {
	// Cleanup all handlers
	Mojo.Event.stopListening(this.controller.get('save-button'), Mojo.Event.tap, this.save);
};

SettingsAssistant.prototype.save = function(event) {
	// Set counter
	this.digits =
		new String(this.digit1Model['value']) +
		new String(this.digit2Model['value']) + 
		new String(this.digit3Model['value']) + 
		new String(this.digit4Model['value']);
	// Close widget
	this.widget.mojo.close();
	// Callback
	this.callbackFunction(this.digits, this.modelDirection['value']);
};
